@extends("/paging_template",minWidth=1000,title="产品列表")
@import com.mgfireworks.mgplatform.mgadmin.constants.*
@import com.mgfireworks.mgplatform.mgadmin.product.model.*
@import com.mgfireworks.mgplatform.mgadmin.sys.model.*
@args List<Product> productList,List<Category> categoryList,List<Band> bandList,List<SellLevel> sellLevelList
<s_panel>
	<s_input name="productId" text="产品编号" value="@val("productId")"></s_input>
	<s_input name="productName" text="产品名" value="@val("productName")"></s_input>
	<s_select name="cateId" text="类别" value="@val("cateId")">
	@if(categoryList){@for(Category c : categoryList){
		<option value="@c.getCateId()">@c.getCateName()</option>
	}}
	</s_select>
	<s_select name="bandId" text="品牌" value="@val("bandId")">
	@if(bandList){@for(Band b : bandList){
		<option value="@b.getBandId()">@b.getBandName()</option>
	}}
	</s_select>
	<s_select name="sellLevel" text="销售级别" value="@val("sellLevel")">
	@if(sellLevelList){@for(SellLevel s : sellLevelList){
		<option value="@s.getLevel()">@s.getLevelName()</option>
	}}
	</s_select>
	<s_select name="recommend" text="推荐" value="@val("recommend")" deftext="所有">
		<option value="1">推荐</option>
		<option value="0">未推荐</option>
	</s_select>
	<s_buttons slot="button" cols="3">
		<s_button type="query"></s_button>
		<s_button type="link" icon="fa-plus" href="@url("add.html")">添加</s_button>
		<s_button type="del" href="@url("del.json?productId={0}")">删除</s_button>
	</s_buttons>
</s_panel>

<div class="row">
	@if(productList){
	@{int i=0;}
	@for(Product p : productList){
    <div class="product-item jsAutoCheckRow col col-sm-12 col-md-12 col-xs-12 col-lg-4">
		<input type="checkbox" name="productId" value="@p.getProductId()"/>
        <div class="thumbnail" style="height: auto;">
            <a href="?">
                <img src="@url(p.getMainImg())" alt="@p.getProductName()">
            </a>
            <div class="caption">
                <div class="pi-info">
                    <div class="pi-buttons">
                        <a href="@url("edit.html?productId=")@p.getProductId()" class="btn btn-lg btn-primary" role="button"><i class="fa fa-pencil"></i>修改</a>
                        <a href="@url("del.json?productId=")@p.getProductId()" class="btn btn-lg btn-default js-json-post" confirm="确定要删除？" result="reload"><i class="fa fa-times"></i>删除</a>
                    </div>
                    <h3>@p.getProductName()</h3>
                    <p>类别：@p.getCategoryName()，品牌：@p.getBandName()</p>
                    <p>销售级别：@p.getSellLevelName()</p>
                </div>
            </div>
        </div>
    </div>
	}}
</div>